import request from '@/utils/request'

export function getRoles(params) {
  return request({
    url: '/sys/role',
    params// 查询参数
  })
}

export function getRolesDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

export function addRoles(data) {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}
export function editRoles(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}
/**
 * 删除
 */
export function delRoles(id) {
  return request({
    url: `/sys/role/${id}`,
    method:'delete'
  })
}

/**
 * 给角色分配权限
 * @data {id,permIds:[]} data
 * @return
 */
export function assignPrem(data) {
  return request({
    url: `/sys/role/assignPrem`,
    method: 'PUT',
    data
  })
}
